from _md5 import md5
from dataclasses import dataclass
from datetime import datetime
from hashlib import sha256
from typing import List
import models
from exts import db
@dataclass
class Order(db.Model):
    __tablename__ = "order"
    id:int = db.Column(db.Integer,primary_key=True,autoincrement=True)
    order_sn:str = db.Column(db.String(255),nullable=False)
    bike_sn:str = db.Column(db.Text,nullable=False)
    user_name:str = db.Column(db.String(255),nullable=False)
    mobile:str = db.Column(db.String(255),nullable=False)
    distance:str = db.Column(db.String(255),nullable=False)
    total_time:str = db.Column(db.String(255),nullable=False)
    status:str = db.Column(db.Integer,nullable=False)
    total_fee:str = db.Column(db.DECIMAL(11,2),nullable=False)
    user_pay:str = db.Column(db.DECIMAL(11,2),nullable=False)
    user_id:int = db.Column(db.Integer,db.ForeignKey("user.id"))
    #author = db.relationship("User",back_populates="articles")
    #user:User = db.relationship("User",backref="orders")
    create_time:str = db.Column(db.DateTime, default=datetime.now)
    update_time:str = db.Column(db.DateTime, default=datetime.now,onupdate=datetime.now)